# -*- python -*-

load(
    "@ros2//:ros_cc.bzl",
    "ros_cc_binary",
    "ros_cc_test",
)
load(
    "@ros2//:ros_py.bzl",
    "ros_py_binary",
    "ros_py_test",
)
load("//tools:cmd_test.bzl", "cmd_test")

# TODO(hidmic): make linter more user-friendly
cmd_test(
    name = "lint_rosdeps",
    cmd = [
        "diff",
        "-u",
        "setup/prereq-rosdep-keys.txt",
        "$(location @ros2//:system-rosdep-keys.txt)",
    ],
    data = [
        "setup/prereq-rosdep-keys.txt",
        "@ros2//:system-rosdep-keys.txt",
    ],
)

ros_cc_test(
    name = "runfiles_cc_test",
    srcs = ["test/runfiles_test.cc"],
    data = ["test/runfiles_test_data.txt"],
    deps = ["@bazel_tools//tools/cpp/runfiles"],
)

ros_py_test(
    name = "runfiles_py_test",
    srcs = ["test/runfiles_test.py"],
    data = ["test/runfiles_test_data.txt"],
    main = "test/runfiles_test.py",
    deps = ["@bazel_tools//tools/python/runfiles"],
)

ros_cc_binary(
    name = "shimmed_sentinel_cc_reexec",
    srcs = ["test/shimmed_sentinel.cc"],
    shim = "reexec",
)

ros_cc_binary(
    name = "shimmed_sentinel_cc_ldwrap",
    srcs = ["test/shimmed_sentinel.cc"],
    shim = "ldwrap",
)

ros_py_binary(
    name = "shimmed_sentinel_py",
    srcs = ["test/shimmed_sentinel.py"],
    main = "test/shimmed_sentinel.py",
)

py_test(
    name = "shimmed_sentinel_test",
    srcs = ["test/shimmed_sentinel_test.py"],
    data = [
        ":shimmed_sentinel_cc_ldwrap",
        ":shimmed_sentinel_cc_reexec",
        ":shimmed_sentinel_py",
    ],
    deps = [
        "@bazel_tools//tools/python/runfiles",
    ],
)

ros_py_test(
    name = "tf2_py_import_test",
    srcs = ["test/tf2_py_import_test.py"],
    main = "test/tf2_py_import_test.py",
    deps = ["@ros2//:tf2_py_py"],
)

ros_cc_test(
    name = "console_bridge_test",
    srcs = ["test/use_console_bridge.cc"],
    deps = ["@ros2//:console_bridge_vendor_cc"],
)
